<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="template.xhtml">
	<ui:define name="corpo">
		<p:outputPanel id="painelGeral">
			<h:dataTable value="#{carrinhoMB.entryLivros}" var="livroEntry" border="2" cellspacing="2">
				<h:column>
					<f:facet name="header" >#{msg.livro}</f:facet>
					#{livroEntry.key.nome}
				</h:column>
				<h:column>
					<f:facet name="header" >#{msg.quantidade}</f:facet>
					<h:commandLink styleClass="icon-minus-sign">
						<f:ajax render="@form" event="click" listener="#{carrinhoMB.diminuirQuantidade(livroEntry.key)}"/>
					</h:commandLink>
					#{livroEntry.value}
					<h:commandLink styleClass="icon-plus-sign">
						<f:ajax render="@form" event="click" listener="#{carrinhoMB.adicionarQuantidade(livroEntry.key)}"/>
					</h:commandLink>
				</h:column>
			</h:dataTable>
			<h1>#{msg.total}: #{carrinhoMB.total}</h1>
			<a href="compra.jsf" class="btn btn-large btn-primary">#{msg.comprar}</a>
		</p:outputPanel>
	</ui:define>
</ui:composition>
</html>